package com.example.intentactivities;

import android.os.Bundle;
import android.app.ActionBar;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends Activity {
	Context mContext;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_one);
		
		mContext = this;
		
		Button b = (Button) findViewById(R.id.first_activity_button);
		b.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				//Create a new Intent
				Intent i = new Intent(mContext, SecondaryActivity.class);
				//Start the Intent
				mContext.startActivity(i);
			}
		});
	}


	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_main, menu);
		return true;
	}

}
